

Lge.newParticle = function(id,m,x,y,h,w,a,icon){
	var particle = Object();
	particle.physics = new Lpe.Particle(particle,m,x,y,h,w,a);
	particle.graphics = new Lgre.Particle(particle,icon);
	particle.id = id;
	particle.type = "particle";
	
	Lge.addItem(particle);
	return particle;
};

Lgre.Particle = function(particle,icon){ 
	this.parent = particle;
	this.icon=icon;
	p = particle.physics;

	this.el=document.createElement('div');
	this.el.className="bs";
	this.el.style.left=p.x-p.w/2;
	this.el.style.bottom=p.y-p.h/2;
	this.el.style.height=p.h;
	this.el.style.width=p.w;
	this.el.style.webkitTransform = 'rotate(-'+ p.a +'rad)';
	this.el.style.backgroundImage="url("+icon+")";
	
	document.body.appendChild(this.el);
};

Lpe.Particle = function(particle,m,x,y,h,w,a){ 
	this.parent = particle;
	this.m = m;
	this.vX = 0;
	this.vY = 0;
	this.vT = 0;
	this.x = x;
	this.y = y;
	this.h = h;
	this.w = w;
	this.a = a*(Math.PI/180);
	
	this.envForce = true;
	this.fm = new Lpe.ForceManager();
};
